package com.star.common.model;

import lombok.Data;

@Data
public class Cache<K,V> implements Comparable<Cache> {

    public static final String MATCH_TYPE_FOOTBALL ="football:";

    public static final String MATCH_TYPE_BASKETBALL ="basketball:";

    public static final String CACHE_TYPE_DATA ="data:";

    public static final String CACHE_TYPE_DETAIL ="detail:";

    public static final String CACHE_TYPE_LIVE ="live:";

    public static final String CACHE_TYPE_ODDS ="odds:";

    public static final String CACHE_TYPE_LINEUP ="lineup:";

    public static final String CACHE_BASKETBALL_MATCH_TIME = "basketball:match:time:";
    public static final String CACHE_FOOTBALL_MATCH_TIME = "football:match:time:";

    /**
     * 最小时间  30秒
     */
    public static final long CACHE_MIN_EXPIRE =30;

    /**
     * 一小时
     */
    public static final long CACHE_GENERAL_EXPIRE =60*60;

    /**
     * 最长时间 一个月
     */
    public static final long CACHE_MAX_EXPIRE = 60*60*24*31;
    // 键
    private K key;
    // 缓存值
    private V value;
    // 最后一次访问时间
    private long accessTime;
    // 创建时间
    private long writeTime;
    // 存活时间
    private long expireTime;
    // 命中次数
    private Integer hitCount;

    @Override
    public int compareTo(Cache o) {
        return hitCount.compareTo(o.hitCount);
    }


}